#pragma once
#include "Tile.h"

class Grid {
private:
    Tile tiles[GRID_SIZE][GRID_SIZE];

public:
    Grid();

    Tile& getTile(int x, int y);
    const Tile& getTile(int x, int y) const;

    bool addRandomTile();
    bool move(int dx, int dy);
    bool isFull() const;
    bool hasValidMoves() const;
    int getMaxTile() const;

    void draw() const;

private:
    bool moveTiles(int dx, int dy);
    bool mergeTiles(int dx, int dy);
    void resetMergedFlags();
};
